gdk/win32: fix integer overflow in monitor refresh rate calculation
authorVolker Rümelin <volker.ruemelin@t-online.de>
Mon, 23 Nov 2020 20:34:01 +0000 (21:34 +0100)
committerVolker Rümelin <volker.ruemelin@t-online.de>
Mon, 23 Nov 2020 20:42:58 +0000 (21:42 +0100)
In gdk/win32/gdkmonitor-win32.c in function
populate_monitor_devices_from_display_config() refresh->Numerator * 1000
overflows for refresh->Numerator > 4294976.

Cast the factor 1000 to UINT64 to prevent the overflow.

Fixes #3394

gdk/win32/gdkmonitor-win32.c

index 0f02bef14f5304381537f10a844fbe4abe15429e..b149a33b636616b7f420f4c75f518ba021ed4d39 100644 (file)
@@ -509,7 +509,7 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors)
 
       refresh = &dispconf_paths[path_index].targetInfo.refreshRate;
       gdk_monitor_set_refresh_rate (mon,
-                                    refresh->Numerator * 1000 / refresh->Denominator);
+                                    refresh->Numerator * (UINT64) 1000 / refresh->Denominator);
     }
 
   g_free (dispconf_paths);